package com.tsxy.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@AllArgsConstructor
@NoArgsConstructor
public class APIResult {
    private String status;
    private String msg;
    private Object data;

  /**
     * Get/Delete使用
     *
     * @param object
     * @return
     */
    /* * public static APIResult ok(Object object) {
        APIResult apiResult = new APIResult();
        apiResult.setData(object);
        apiResult.setStatus(200);
        return apiResult;
    }

    public static APIResult create(Object object) {
        APIResult apiResult = new APIResult();
        apiResult.setData(object);
        apiResult.setStatus(201);
        return apiResult;
    }

    public static APIResult notFound(String msg) {
       APIResult apiResult = new APIResult();
        apiResult.setMsg(msg);
        apiResult.setStatus(404);
        return apiResult;
    }

    public static APIResult unauthorized(String msg) {
        APIResult apiResult = new APIResult();
        apiResult.setMsg(msg);
        apiResult.setStatus(401);
        return apiResult;
    }*/
    public static APIResult success(){
        return new APIResult(Constants.CODE_200,"成功",null);
    }
    public static APIResult success(Object obj){
        return new APIResult(Constants.CODE_200,"成功",obj);
    }
    public static APIResult error(){
        return new APIResult(Constants.CODE_500,"系统错误",null);
    }
    public static APIResult error(String code,String msg){
        return new APIResult(code,msg,null);
    }


}
